# from demo_unittest.listTest.myList import MyList
from parameterized import parameterized
import unittest, sys

sys.path.append(u'E:\\Python\\APITest\\demo_unittest\\listTest')
from myList import MyList


class TestMyAllNum(unittest.TestCase):
    # 数据存放在列表中, 列表中的每组数据存放在元组中
    # 注意: 参数传递时True和False不是字符串, 是布尔类型的值
    @parameterized.expand([([1, 2, 3, 4], True), (['hello', 2, 3], False)])
    def testCase(self, mylist, expect):
        ml = MyList(mylist)
        actual = ml.myAllNumber()
        self.assertEqual(expect, actual)


if __name__ == '__main__':
    suite = unittest.TestSuite()
    testCases = unittest.TestLoader().loadTestsFromTestCase(TestMyAllNum)
    suite.addTest(test=testCases)
    r = unittest.TestResult()
    suite.run(result=r)
    print(r.__dict__)
